package fr.n7.sma.model;

import java.util.Map;

public class AgentAction {

	public enum Action {WALK, TAKE, PUT};
	
	private Action action;
	
	private short[] pos;
	
	private short[] to;
	
	private String resourceName;

	public AgentAction(Action action, short[] pos, String resourceName) {
		super();
		this.action = action;
		this.pos = pos;
		this.resourceName = resourceName;
	}

	public AgentAction(short[] pos, short[] to) {
		super();
		this.action = Action.WALK;
		this.pos = pos;
		this.to = to;
	}

	public Action getAction() {
		return action;
	}

	public short[] getPos() {
		return pos;
	}

	public short[] getTo() {
		return to;
	}

	public String getResourceName() {
		return resourceName;
	}

	public String toString(Map<String, Integer> map){
		switch(action){
		case WALK: return "wa";
		case PUT: return "p"+map.get(resourceName);
		case TAKE: return "t"+map.get(resourceName);
		default: return "??";
		}
	}
	
	@Override
	public String toString(){
		switch(action){
		case WALK: return "wa";
		case PUT: return "p"+resourceName;
		case TAKE: return "t"+resourceName;
		default: return "??";
		}
	}
	
}